package nl.gamayun.whohasit;

import nl.gamayun.whohasit.utils.WhoHasItUtils;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class AboutDialog extends Dialog
{

	public AboutDialog(Context context)
	{
		super(context);
		setupDialog(context);
	}

	public AboutDialog(Context context, int theme)
	{
		super(context, theme);
		setupDialog(context);
	}

	private void setupDialog(Context context)
	{
		setContentView(R.layout.about);

		// set the dialog text
		((TextView) findViewById(R.id.aboutTitle)).setText(R.string.about);
		((TextView) findViewById(R.id.aboutMessage)).setText(R.string.about_text);
		((TextView) findViewById(R.id.thanksMessage)).setText(R.string.about_thanks);
		((TextView) findViewById(R.id.copyright)).setText(R.string.copyright);
		TextView version = (TextView) findViewById(R.id.version);
		version.setText(getContext().getString(R.string.version, WhoHasItUtils.getAppVersion()));
		// set the confirm button
		Button okButton = (Button) findViewById(R.id.okButton);
		okButton.setOnClickListener(new View.OnClickListener()
		{
			public void onClick(View view)
			{
				dismiss();
			}
		});
	}
}
